﻿//********************************************************************************//
//创建日期：<创建日期，2016-04-20>
//创建作者：<郭登杰，guodengjie@shanghai3h.com>
//功能说明：账单信息Model
//********************************************************************************//
using System;
using System.Collections.Generic;
using YXYLCommon;
using System.Data;

namespace Entity
{
    [Serializable]
    /// <summary>
    /// 地表水打印账单信息
    /// </summary>
    public class QSSFZhangDanXX_DBS : BaseModel
    {
        public QSSFZhangDanXX_DBS()
        {
          
        }

        public int I_ZHUANGTAI { get; set; }
        public int ID { get; set; }

        public string S_ZHANGDANBH { get; set; }

        public string S_YONGHUH { get; set; }

        public string S_YONGHUM { get; set; }

        public int I_YM { get; set; }

        public decimal N_JINE { get; set; }
        public decimal N_SHUIJIA { get; set; }
        public int I_YSL { get; set; }

        public string S_TIAOXINGM { get; set; }

        public string S_XIANJIAORQ { get; set; }

        //public string S_DAYINRQ { get; set; }

        public string S_DANWEI { get; set; }

        public string S_FAPIAOHM { get; set; }

        public DbDateTime D_DAYINRQ { get; set; }

        public override BaseModel ToObject(System.Data.DataRow row)
        {
            this.IsExists = true;
            this.I_ZHUANGTAI = Convert.ToInt32(row["I_ZHUANGTAI"]);
            this.S_ZHANGDANBH = Convert.ToString(row["S_ZHANGDANBH"]);
            this.S_YONGHUH = Convert.ToString(row["S_YONGHUH"]);
            this.S_YONGHUM = Convert.ToString(row["S_YONGHUM"]);
            this.I_YM = Convert.ToInt32(row["I_YM"]);
            this.N_JINE = Convert.ToDecimal(row["N_JINE"]);
            this.N_SHUIJIA = Convert.ToDecimal(row["N_SHUIJIA"]);
            this.I_YSL = Convert.ToInt32(row["I_YSL"]);
            this.S_TIAOXINGM = Convert.ToString(row["S_TIAOXINGM"]);
            this.S_XIANJIAORQ = Convert.ToString(row["S_XIANJIAORQ"]);
            //this.S_DAYINRQ = Convert.ToString(row["S_DAYINRQ"]);
            this.S_DANWEI = Convert.ToString(row["S_DANWEI"]);
            this.S_FAPIAOHM = Convert.ToString(row["S_FAPIAOHM"]);
            this.D_DAYINRQ = row.Table.Columns.Contains("D_DAYINRQ") ? DbDateTime.Parse(row["D_DAYINRQ"]) : DbDateTime.Parse(null);
            return this;
        }
    }


    public class QSSFZhangDanDYTJ : BaseModel
    {
        public QSSFZhangDanDYTJ()
        {

        }

        public string S_QISHIFPHM { get; set; }

        public string S_JIESHUFPHM { get; set; }

        public int I_SL { get; set; }

        //public string S_DAYINRQ { get; set; }
        public DbDateTime D_DAYINRQ { get; set; }

        public override BaseModel ToObject(System.Data.DataRow row)
        {
            this.IsExists = true;
            this.S_QISHIFPHM = Convert.ToString(row["S_QISHIFPHM"]);
            this.S_JIESHUFPHM = Convert.ToString(row["S_JIESHUFPHM"]);
            this.I_SL = Convert.ToInt32(row["I_SL"]);
            //this.S_DAYINRQ = Convert.ToString(row["S_DAYINRQ"]);
            this.D_DAYINRQ = row.Table.Columns.Contains("D_DAYINRQ") ? DbDateTime.Parse(row["D_DAYINRQ"]) : DbDateTime.Parse(null);
            return this;
        }
    }
    public class DALQSSFZhangDanXX_DBS : BaseDAL
    {
        public DALQSSFZhangDanXX_DBS()
        {

        }
        protected override void fillSaveProc(BaseModel model)
        {
            
        }

        public List<QSSFZhangDanXX_DBS> Get(int ym,int printed,DbDateTime printdate)
        {
            dbProc.Init("P_QSSF_DAYINZDXXHQ_DBS");
            dbProc.AddParameter("V_YM", ym);
            dbProc.AddParameter("V_PRINTED", printed);
            dbProc.AddParameter("V_PRINTDATE", printdate.TimeDBParameter);
            return CommonService.Ini().GetList<QSSFZhangDanXX_DBS>(dbProc);
        }

        /// <summary>
        /// 获取已打印账单信息
        /// </summary>
        /// <param name="zt">打印状态 0:全部 1:成功 2:打坏</param>
        /// <param name="ym">水量年月</param>
        /// <param name="hm">发票或费用编号</param>
        /// <param name="printdate">打印日期</param>
        public List<QSSFZhangDanXX_DBS> Get2(int zt, int ym, string hm, DbDateTime printdate)
        {
            dbProc.Init("P_QSSF_DAYINZDXXHQ2_DBS");
            dbProc.AddParameter("V_ZHUANGTAI", zt);
            dbProc.AddParameter("V_YM", ym);
            dbProc.AddParameter("V_HM", hm);
            dbProc.AddParameter("V_PRINTDATE", printdate.TimeDBParameter);
            return CommonService.Ini().GetList<QSSFZhangDanXX_DBS>(dbProc);
        }

        /// <summary>
        /// 发票打印状态变更
        /// </summary>
        /// <param name="zt">1:成功  2:打坏 0:未打印</param>
        /// <param name="fphms">发票号码s</param>
        public DbCmdResult DaYinZTBG(int zt,string fphms)
        {
            dbProc.Init("P_QSSF_ZDDYZTBG_DBS");
            dbProc.AddParameter("V_ZHUANGTAI", zt);
            dbProc.AddParameter("V_FAPIAOHMS", fphms);
            return CommonService.Ini().ExcuteProcOracle(dbProc);
        }

        public List<QSSFZhangDanDYTJ> DaYinTJGet(DbDateTime printdate)
        {
            dbProc.Init("P_QSSF_ZDDYTJ_DBS");
            dbProc.AddParameter("V_PRINTDATE", printdate.TimeDBParameter);
            return CommonService.Ini().GetList<QSSFZhangDanDYTJ>(dbProc);
        }       
    }

}